home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / direct2a / gradient.bas < prev    next >
BASIC Source File  |  1999-10-19  |  1KB  |  65 lines

  1. Attribute VB_Name = "General"
  2. Type Colour
  3.     R As Single
  4.     G As Single
  5.     B As Single
  6. End Type
  7.  
  8.  
  9. Global S As Colour
  10. Global E As Colour
  11.  
  12. Global Floor(64, 48) As Integer
  13. Global Value(64, 48) As Integer
  14.  
  15. Global LevelName As String
  16. Global Creator As String
  17. Global Password As String
  18. Global txtColour As String
  19. Global Theme As String
  20. Global Points As Integer
  21.  
  22. Global GStart As Colour
  23. Global GEnd As Colour
  24.  
  25. Global levelnum As Integer
  26.  
  27. Global ShowDebug As Boolean
  28. Global ShowInfo As Boolean
  29.  
  30. Type Player
  31.     X As Integer
  32.     Y As Integer
  33.     oldX As Integer
  34.     oldY As Integer
  35.     Frame As Integer
  36. End Type
  37.  
  38. Global P1 As Player
  39.  
  40. Type ScBox
  41.     X As Integer
  42.     Y As Integer
  43. End Type
  44.  
  45. Global SBox As ScBox
  46. Sub Gradient(SR As Single, SG As Single, SB As Single, ER As Single, EG As Single, EB As Single, direction As Integer, where As Object)
  47. On Error Resume Next
  48. Dim d As Colour
  49.     d.R = (E.R - S.R) / 1536 'where.ScaleWidth
  50.     d.G = (E.G - S.G) / 1536 'where.ScaleWidth
  51.     d.B = (E.B - S.B) / 1536 'where.ScaleWidth
  52.     
  53. Dim c As Colour
  54. c.R = S.R: c.G = S.G: c.B = S.B
  55.  
  56. For X = 0 To 1536 'where.ScaleWidth
  57.     where.Line (0, X)-Step(2048, X), RGB(c.R, c.G, c.B)
  58.  
  59.     c.R = c.R + d.R
  60.     c.G = c.G + d.G
  61.     c.B = c.B + d.B
  62. Next X
  63. End Sub
  64.  
  65.